From 034f2cd52e29f4af4a092d5270e3f992a751507f Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Wed, 23 Nov 2005 18:47:54 +0000 Subject: [PATCH] Inside xenbus_switch_state, don't write the new state if the node has already disappeared. This happens when the driver is being torn down, and we don't want to resurrect the device directory in the store because of it. Partially addresses bug #424. Signed-off-by: Ewan Mellor --- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c index 869ce26906..b28cc76c48 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c @@ -97,14 +97,17 @@ int xenbus_switch_state(struct xenbus_device *dev, /* We check whether the state is currently set to the given value, and if not, then the state is set. We don't want to unconditionally write the given state, because we don't want to fire watches - unnecessarily. + unnecessarily. Furthermore, if the node has gone, we don't write + to it, as the device will be tearing down, and we don't want to + resurrect that directory. */ int current_state; int err = xenbus_scanf(xbt, dev->nodename, "state", "%d", ¤t_state); - if (err == 1 && (XenbusState)current_state == state) + if ((err == 1 && (XenbusState)current_state == state) || + err == -ENOENT) return 0; err = xenbus_printf(xbt, dev->nodename, "state", "%d", state); -- 2.30.2